﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;


namespace HZ.Supervise.Web.Secondphase.ReportHospital
{
    public partial class hospitalPrescriptionDetail : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                banding();
            }
        }
        private void banding()
        {


            string strHostpitalid = "";
            strHostpitalid = Request.QueryString["id"].ToString();
            int totalrecord = 0;
            HZ.Supervise.IBLL.IBLL_Prescription iPrescription = HZ.Supervise.BLLFactory.IBl_Prescription();

            //明细查看
            DataTable data = iPrescription.GetHospitalePrescrioDetail2(strHostpitalid);
            if (data.Rows.Count > 0)
            {
                string strPrescriptName = string.Empty;
                string strPdoctoName = string.Empty;
                string strPatientName = string.Empty;
                string strPaddTime = string.Empty;
                string strPastyName = string.Empty;
                string strPessAmount = string.Empty;

                if (data.Rows[0]["PrescriptionName"] != DBNull.Value && !string.IsNullOrEmpty(data.Rows[0]["PrescriptionName"].ToString().Trim()))
                {
                    strPrescriptName = data.Rows[0]["PrescriptionName"].ToString().Trim();
                }
                if (data.Rows[0]["PdoctorName"] != DBNull.Value && !string.IsNullOrEmpty(data.Rows[0]["PdoctorName"].ToString().Trim()))
                {
                    strPdoctoName = data.Rows[0]["PdoctorName"].ToString().Trim();
                }
                if (data.Rows[0]["PatientName"] != DBNull.Value && !string.IsNullOrEmpty(data.Rows[0]["PatientName"].ToString().Trim()))
                {
                    strPatientName = data.Rows[0]["PatientName"].ToString().Trim();
                }
                if (data.Rows[0]["Paddtime"] != DBNull.Value && !string.IsNullOrEmpty(data.Rows[0]["Paddtime"].ToString().Trim()))
                {
                    strPaddTime = data.Rows[0]["Paddtime"].ToString().Trim();
                }

                if (data.Rows[0]["PsympToms"] != DBNull.Value && !string.IsNullOrEmpty(data.Rows[0]["PsympToms"].ToString().Trim()))
                {
                    strPastyName = data.Rows[0]["PsympToms"].ToString().Trim();
                }



                if (data.Rows[0]["PtotalAmount"] != DBNull.Value && !string.IsNullOrEmpty(data.Rows[0]["PtotalAmount"].ToString().Trim()))
                {
                    strPessAmount = data.Rows[0]["PtotalAmount"].ToString().Trim();
                }

				this.labMessage.Text = string.Format("处方单名称：{0}<br>医生名称：{1}<br>病人名称：{2}<br>开方时间：{3}<br>疾病种类：{4}<br>处方单基本药物总金额：{5}", strPrescriptName, strPdoctoName, strPatientName, strPaddTime, strPastyName, strPessAmount);
            }
            else
            {
                this.labMessage.Text = "数据未获取";
            }


            //
            string strwhere = "";

            if (!strHostpitalid.Trim().Equals(""))//医院名称
            {
                strwhere += " and PrescriptionId  = '" + strHostpitalid + "'";
            }
            DataTable dt = iPrescription.GetHospitaleTB_PrescriptionDetail(strwhere, this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize, out totalrecord);
            AspNetPager1.RecordCount = totalrecord;
            this.gvwDetail.DataSource = dt;
            this.gvwDetail.DataBind();


        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            banding();
        }

    }
}
